import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import pinia from './store'

// 权限路由
import './permission'
// svg-icons注册导入
import 'virtual:svg-icons-register'
import SvgIcon from '@/components/SvgIcon/index.vue' // svg component
// UI框架 element-plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// 引入阿里图标库
import '@/assets/iconfont/iconfont.css'
import '@/assets/iconfont/iconfont.js'
import '@/assets/font_order/iconfont.css'
import '@/assets/font_order/iconfont.js'

// material-icons字体图标（设计图的图标）在线编辑文本
import '@/icons/iconfont/material-icons.css'
import '@/icons/iconfont/MaterialIcons-Regular.woff2'

// font-awesome字体图标（原来第一版本的图标）https://fontawesome.com.cn/v4/icons
import '@/icons/font-awesome/css/font-awesome.min.css'

import WatchLogin from '@/components/WatchLogin/index.vue'
import SelfDefined from '@/components/SelfDefined/index.vue'
import ShowTooltip from '@/components/ShowTooltip.vue'
import { HButton, HPlainButton, HPlainBgButton, HLink, HStatus, HModal } from '@/components/common'
import AssignNetwork from '@/components/pages/order/index/AssignNetwork/AssignNetwork.vue'
import UpdateNetwork from '@/components/pages/order/index/UpdateNetwork/UpdateNetwork.vue'
import ServiceProcess from '@/components/pages/order/index/ServiceProcess/ServiceProcess.vue'
import FinishOrder from '@/components/pages/order/index/FinishOrder/FinishOrder.vue'
import UpdateSettlementPrice from '@/components/pages/order/index/UpdateSettlementPrice/UpdateSettlementPrice.vue'
import * as ElIconsModules from '@element-plus/icons-vue'

const app = createApp(App)
app
  .component('svg-icon', SvgIcon)
  .component('WatchLogin', WatchLogin)
  .component('SelfDefined', SelfDefined)
  .component('ShowTooltip', ShowTooltip)
  .component('HButton', HButton)
  .component('HPlainButton', HPlainButton)
  .component('HPlainBgButton', HPlainBgButton)
  .component('HLink', HLink)
  .component('HStatus', HStatus)
  .component('HModal', HModal)
  .component('AssignNetwork', AssignNetwork)
  .component('UpdateNetwork', UpdateNetwork)
  .component('ServiceProcess', ServiceProcess)
  .component('FinishOrder', FinishOrder)
  .component('UpdateSettlementPrice', UpdateSettlementPrice)

// 全局注册element-plus icon图标组件
Object.keys(ElIconsModules).forEach((key) => {
  //循环遍历组件名称
  if ('Menu' !== key) {
    //如果不是图标组件不是Menu，就跳过，否则加上ICon的后缀
    app.component(key, ElIconsModules[key])
  } else {
    app.component(key + 'Icon', ElIconsModules[key])
  }
})

app.use(pinia)
app.use(router)
app.use(ElementPlus).mount('#app')
